#ifndef WIDGET_H
#define WIDGET_H

#include <head/g_functionbase.h>
#include "common/baseresteditor.h"
#include "p_additem.h"

namespace Ui {
class Widget;
}

class Widget : public BaseRestEditor
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

    void generateMenu();
    void customKeyEvent(QKeyEvent *event);
    void updateMonth();
    void updateListView();
    void updateTableView();
    void newItem();
    void editItem();
    void delayUpdateView();

    void onReceivedObject(const QJsonObject &object);
    void processParlor(const QJsonObject &object);
    void onAddItem(const QJsonObject &obj);
    void onUpdateItem(const QJsonObject &obj);

private slots:
    void on_month_currentTextChanged(const QString &month);
    void on_listView_doubleClicked(const QModelIndex &index);
    void on_kw_returnPressed();
    void on_tableView_doubleClicked(const QModelIndex &index);

private:
    Ui::Widget *ui;

    QStringList dates;
    QString selectDate;
};

#endif // WIDGET_H
